package com.xiaoxu.intranetweb.mybatisplusSzappdb.controller.truck;

import com.alibaba.fastjson.JSONObject;
import com.xiaoxu.intranetweb.mybatisplusSzappdb.service.impl.TTrucksOvertimeServiceImpl;
import com.xiaoxu.intranetweb.util.SzResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/truckOverTime")
public class TrucksOverTimeController {
    @Autowired
    private TTrucksOvertimeServiceImpl trucksOvertimeService;
    @PostMapping("/getTruckOverTimeList")
    public SzResult getTruckOverTimeList(@RequestBody JSONObject jsonObject){
        Integer page = jsonObject.getInteger("page");
        Integer pageSize = jsonObject.getInteger("pageSize");
        String truckNo = jsonObject.getString("truckNo");
        String startTime = jsonObject.getString("startTime");
        String endTime = jsonObject.getString("endTime");
        return trucksOvertimeService.getTruckOverTimeList(page,pageSize,truckNo,startTime,endTime);
    }

    @PostMapping ("/delTruckOverTimeList")
    public SzResult delTruckOverTimeList(@RequestBody JSONObject jsonObject) throws Exception {
        String id = jsonObject.getString("id");
        return trucksOvertimeService.delTruckOverTimeList(id);
    }
}
